<template>
  <view class="empty-state">
    <view class="empty-icon">
      <text class="icon-text">{{ icon }}</text>
    </view>
    <view class="empty-title">{{ title }}</view>
    <view class="empty-description" v-if="description">{{ description }}</view>
    <button 
      class="empty-button" 
      v-if="buttonText" 
      @click="handleButtonClick"
    >
      {{ buttonText }}
    </button>
  </view>
</template>

<script setup lang="ts">
interface Props {
  title: string
  description?: string
  icon?: string
  buttonText?: string
}

const props = withDefaults(defineProps<Props>(), {
  icon: '📭',
  title: '暂无数据'
})

const emit = defineEmits<{
  buttonClick: []
}>()

const handleButtonClick = () => {
  emit('buttonClick')
}
</script>

<style lang="scss" scoped>
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  
  .empty-icon {
    margin-bottom: 16px;
    
    .icon-text {
      font-size: 64px;
      opacity: 0.5;
    }
  }
  
  .empty-title {
    font-size: 18px;
    font-weight: 500;
    color: #303133;
    margin-bottom: 8px;
  }
  
  .empty-description {
    font-size: 14px;
    color: #909399;
    line-height: 1.5;
    margin-bottom: 24px;
  }
  
  .empty-button {
    padding: 10px 24px;
    background: #409EFF;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
  }
}
</style>
